/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package nueva.esperanza.modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author mgcharuc
 */
@Entity
@Table(name = "CHEQUERA",schema = "SYSTEM")
@SequenceGenerator(name="seqChequera", sequenceName="SYSTEM.CHEQUERA_SEQ" )
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Chequera.findAll", query = "SELECT c FROM Chequera c"),
    @NamedQuery(name = "Chequera.findByIdchequera", query = "SELECT c FROM Chequera c WHERE c.idchequera = :idchequera"),
    @NamedQuery(name = "Chequera.findByNumerochequera", query = "SELECT c FROM Chequera c WHERE c.numerochequera = :numerochequera"),
    @NamedQuery(name = "Chequera.findBySecuenciainicialcheque", query = "SELECT c FROM Chequera c WHERE c.secuenciainicialcheque = :secuenciainicialcheque"),
    @NamedQuery(name = "Chequera.findBySecuencia", query = "SELECT c FROM Chequera c WHERE c.secuencia = :secuencia"),
    @NamedQuery(name = "Chequera.findBySecuenciafinalcheque", query = "SELECT c FROM Chequera c WHERE c.secuenciafinalcheque = :secuenciafinalcheque")})
public class Chequera implements Serializable {
    private static final long serialVersionUID = 1L;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Id
    @Basic(optional = false)
    @GeneratedValue(generator = "seqChequera")
    @Column(name = "IDCHEQUERA")
    private BigDecimal idchequera;
    @Basic(optional = false)
    @Column(name = "NUMEROCHEQUERA")
    private BigInteger numerochequera;
    @Basic(optional = false)
    @Column(name = "SECUENCIAINICIALCHEQUE")
    private BigInteger secuenciainicialcheque;
    @Basic(optional = false)
    @Column(name = "SECUENCIA")
    private BigInteger secuencia;
    @Basic(optional = false)
    @Column(name = "SECUENCIAFINALCHEQUE")
    private BigInteger secuenciafinalcheque;
    @JoinColumn(name = "IDCUENTA", referencedColumnName = "IDCUENTA")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Cuenta idcuenta;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idchequera", fetch = FetchType.LAZY)
    private List<Cheque> chequeList;

    public Chequera() {
    }

    public Chequera(BigDecimal idchequera) {
        this.idchequera = idchequera;
    }

    public Chequera(BigDecimal idchequera, BigInteger numerochequera, BigInteger secuenciainicialcheque, BigInteger secuencia, BigInteger secuenciafinalcheque) {
        this.idchequera = idchequera;
        this.numerochequera = numerochequera;
        this.secuenciainicialcheque = secuenciainicialcheque;
        this.secuencia = secuencia;
        this.secuenciafinalcheque = secuenciafinalcheque;
    }

    public BigDecimal getIdchequera() {
        return idchequera;
    }

    public void setIdchequera(BigDecimal idchequera) {
        this.idchequera = idchequera;
    }

    public BigInteger getNumerochequera() {
        return numerochequera;
    }

    public void setNumerochequera(BigInteger numerochequera) {
        this.numerochequera = numerochequera;
    }

    public BigInteger getSecuenciainicialcheque() {
        return secuenciainicialcheque;
    }

    public void setSecuenciainicialcheque(BigInteger secuenciainicialcheque) {
        this.secuenciainicialcheque = secuenciainicialcheque;
    }

    public BigInteger getSecuencia() {
        return secuencia;
    }

    public void setSecuencia(BigInteger secuencia) {
        this.secuencia = secuencia;
    }

    public BigInteger getSecuenciafinalcheque() {
        return secuenciafinalcheque;
    }

    public void setSecuenciafinalcheque(BigInteger secuenciafinalcheque) {
        this.secuenciafinalcheque = secuenciafinalcheque;
    }

    public Cuenta getIdcuenta() {
        return idcuenta;
    }

    public void setIdcuenta(Cuenta idcuenta) {
        this.idcuenta = idcuenta;
    }

    @XmlTransient
    public List<Cheque> getChequeList() {
        return chequeList;
    }

    public void setChequeList(List<Cheque> chequeList) {
        this.chequeList = chequeList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idchequera != null ? idchequera.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Chequera)) {
            return false;
        }
        Chequera other = (Chequera) object;
        if ((this.idchequera == null && other.idchequera != null) || (this.idchequera != null && !this.idchequera.equals(other.idchequera))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "nueva.esperanza.modelo.Chequera[ idchequera=" + idchequera + " ]";
    }
    
}
